<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>ScintillaGadget</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<font face="Verdana, sans-serif" size="2"><p align="center"><b><font size="4">ScintillaGadget()</font></b></p>
<p><b>语法</b></p><blockquote>

Result = <font color="#3A3966"><b>ScintillaGadget</b></font>(#Gadget, x, y, Width, Height, @Callback())</blockquote>

</blockquote>
<b>概要</b><br><blockquote>



Creates a new scintilla editing control in the current GadgetList. 
<a href="initscintilla.html">InitScintilla()</a> has to be called successfully before using this command. 

 

</blockquote><p><b>参数</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>#Gadget</i></td>
<td width="90%"> 
A number to identify the new gadget. <a href="../reference/purebasic_objects.html">#PB_Any</a> 可以用来自动生成这个编码. 

</td></tr>
<tr><td><i>x, y, Width, Height</i></td>
<td> 
 
The position and dimensions of the new gadget. 

 

</td></tr>
<tr><td><i>@Callback()</i></td>
<td> 
 
The address of a procedure to receive events from the control. It must be defined 
as follows, where 'Gadget' is the gadget number of the control and *scinotify points to a structure 
with information on the event: 
 
<pre><font face="Courier New, Courier, mono"size="2">
  <b><font color="#3A3966">Procedure</font></b> <font color="#3A3966">ScintillaCallBack</font>(Gadget, *scinotify.SCNotification)
    <font color="#3A3966">; You code here</font>
  <b><font color="#3A3966">EndProcedure</font></b>

</font></pre>

</td></tr>
</table>
</blockquote><p><b>返回值</b></p><blockquote>



Nonzero on success, zero otherwise. If <font color="#924B72">#PB_Any</font> was used as the #Gadget parameter 
then the return-value is the auto-generated gadget number on success. 

 

</blockquote><p><b>备注</b></p><blockquote>



The following events are supported through <a href="../window/eventtype.html">EventType()</a>: 
 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_EventType_RightClick</font>
</font></pre>



After creation, Scintilla specific commands may be sent to the control with the 
<a href="scintillasendmessage.html">ScintillaSendMessage()</a> command. In addition common gadget commands like 
<a href="../gadget/resizegadget.html">ResizeGadget()</a> or <a href="../gadget/hidegadget.html">HideGadget()</a> may be used 
with the control as well. 

 

</blockquote><p><b>示例</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#3A3966">Procedure</font></b> <font color="#3A3966">MakeScintillaText</font>(text.s)
    <b><font color="#3A3966">Static</font></b> sciText.s
    <b><font color="#3A3966">CompilerIf</font></b> <font color="#924B72">#PB_Compiler_Unicode</font>
      sciText =<font color="#3A3966"> Space</font>(<font color="#3A3966">StringByteLength</font>(text, <font color="#924B72">#PB_UTF8</font>))
<font color="#3A3966">      PokeS</font>(@sciText, text, -1, <font color="#924B72">#PB_UTF8</font>)
    <b><font color="#3A3966">CompilerElse</font></b>
      sciText = text
    <b><font color="#3A3966">CompilerEndIf</font></b>
    <b><font color="#3A3966">ProcedureReturn</font></b> @sciText
  <b><font color="#3A3966">EndProcedure</font></b>
  
  <b><font color="#3A3966">If</font></b> <font color="#3A3966">OpenWindow</font>(0, 0, 0, 320, 90, "ScintillaGadget", <font color="#924B72">#PB_Window_SystemMenu</font> | <font color="#924B72">#PB_Window_ScreenCentered</font>)
    
    <b><font color="#3A3966">If</font></b> <font color="#3A3966">InitScintilla</font>()
<font color="#3A3966">      ScintillaGadget</font>(0, 10, 10, 300, 70, 0)
      
      <font color="#3A3966">; Output set to red color</font>
<font color="#3A3966">      ScintillaSendMessage</font>(0, <font color="#924B72">#SCI_STYLESETFORE</font>, 0,<font color="#3A3966"> RGB</font>(255, 0, 0))
      
      <font color="#3A3966">; Set the initial text to the ScintillaGadget</font>
<font color="#3A3966">      ScintillaSendMessage</font>(0, <font color="#924B72">#SCI_SETTEXT</font>, 0,<font color="#3A3966"> MakeScintillaText</font>("This is a simple ScintillaGadget with text..."))
      
      <font color="#3A3966">; Adding a second line of text with linebreak before</font>
      Text$ =<font color="#3A3966"> Chr</font>(10) + "Second line"
<font color="#3A3966">      ScintillaSendMessage</font>(0, <font color="#924B72">#SCI_APPENDTEXT</font>,<font color="#3A3966"> Len</font>(Text$),<font color="#3A3966"> MakeScintillaText</font>(Text$))
    <b><font color="#3A3966">EndIf</font></b>
    
    <b><font color="#3A3966">Repeat</font></b> : <b><font color="#3A3966">Until</font></b> <font color="#3A3966">WaitWindowEvent</font>() = <font color="#924B72">#PB_Event_CloseWindow</font>
  <b><font color="#3A3966">EndIf</font></b>
</font></pre>

<p><img src="../HelpPictures/scintillagadget.png"></p>

</Blockquote><p><b>已支持操作系统 </b><Blockquote>所有</Blockquote></p><center>&lt;- <a href=initscintilla.html>InitScintilla()</a> - <a href="index.html">Scintilla Index</a> - <a href="scintillasendmessage.html">ScintillaSendMessage()</a> -&gt;<br><br>

</body></html>